package com.toe.recommend.webapi.controller;


import com.toe.common.restful.JsonResult;
import com.toe.pojo.dto.recommend.RecommendFoodDTO;
import com.toe.pojo.vo.recommend.RecommendFoodVO;
import com.toe.recommend.webapi.service.impl.RecommendFoodServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 陶涛
 * @since 2022-07-19
 */
@RestController
@RequestMapping("/webapi")
@Api(tags = "膳食推荐模块")
public class RecommendFoodController {
    @Autowired
    RecommendFoodServiceImpl recommendFoodService;

    @PostMapping("/recommend-food")
    @ApiOperation(value = "根据用户的bmi指标推荐适合的食物")
    public JsonResult<List<List<RecommendFoodVO>>> RecommendByBMI(@RequestBody RecommendFoodDTO recommendFoodDTO) {
        List<List<RecommendFoodVO>> recommendByBMI = recommendFoodService.recommendByBMI(recommendFoodDTO);
        return JsonResult.ok(recommendByBMI);
    }

}

